﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace YArchitech.Revit.MEP.Opening
{
	public partial class DlgRemark : System.Windows.Forms.Form
	{
		public DlgRemark(DbOpeningBase opening)
		{
			this.mDobList.Add(opening);
			this.InitializeComponent();
		}

		public DlgRemark(List<DbOpeningBase> dobList)
		{
			this.mDobList = dobList;
			this.InitializeComponent();
		}

		private void DlgRemark_Load(object sender, EventArgs e)
		{
			if (this.mDobList.Count <= 1)
			{
				this.chkOpened.Checked = (this.mDobList[0].Status == OpeningStatus.Opened);
				this.txtRemark.Text = this.mDobList[0].Remark;
			}
		}

		private void btnOK_Click(object sender, EventArgs e)
		{
			foreach (DbOpeningBase dbOpeningBase in this.mDobList)
			{
				dbOpeningBase.Status = (this.chkOpened.Checked ? OpeningStatus.Opened : OpeningStatus.Unopen);
				dbOpeningBase.Remark = this.txtRemark.Text;
			}
		}

		private List<DbOpeningBase> mDobList = new List<DbOpeningBase>();
	}
}
